<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition
	xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui" 
	template="/WEB-INF/templates/template.xhtml">
	
	<ui:define name="headIncludes">
		<f:event listener="#{contaReceberBean.initializeForm(param.contaReceberId)}" type="preRenderView"/>
	</ui:define>
	
	<ui:define name="pageName">Detalhe de Conta a Receber</ui:define>
	<ui:define name="buttons">
		<p:commandButton value="Dar baixa na conta" style="height:28px;" action="#{contaReceberBean.changeToDarBaixaConta}" rendered="#{contaReceberBean.currentConta.status == 'PENDENTE'}" icon="ui-icon-check"/>
		<p:commandButton value="Voltar" style="height:28px;" action="#{contaReceberBean.changeToList}" process="@this" icon="ui-icon-arrowreturnthick-1-w"/>			
	</ui:define>
	
	<ui:define name="content">	
		<p:panel>
			<div>
				<p:messages autoUpdate="true" id="messageDetailConta" closable="true"/>
				
				<h:panelGrid columns="1" style="padding:5px;">
					<h:outputText style="font-weight:bold;padding:7px;" value="Cliente" />
					<h:outputText style="padding:7px;" value="#{contaReceberBean.currentConta.cliente.nome}"/>
				</h:panelGrid>
				
				<h:panelGrid columns="5" style="padding:5px;">
					<h:outputText style="font-weight:bold;padding:7px;" value="Nº do documento" />
					<h:outputText style="font-weight:bold;padding:7px;" value="Descrição" />
					<h:outputText style="font-weight:bold;padding:7px;" value="Data de emissão" />
					<h:outputText style="font-weight:bold;padding:7px;" value="Valor" />
					<h:outputText style="font-weight:bold;padding:7px;" value="Data de vencimento" />
					
					<h:outputText style="padding:7px;" value="#{contaReceberBean.currentConta.id}"/>
					<h:outputText style="padding:7px;" value="#{contaReceberBean.currentConta.descricao}"/>
					<h:outputText style="padding:7px;" value="#{contaReceberBean.currentConta.dataEmissao}">
						<f:convertDateTime pattern="dd/MM/yyyy"/>
					</h:outputText>
					<h:outputText style="padding:7px;" value="#{contaReceberBean.currentConta.valor}">
						<f:convertNumber pattern="R$ #,###,##0.00" />
					</h:outputText>
					<h:outputText style="padding:7px;" value="#{contaReceberBean.currentConta.dataVencimento}">
						<f:convertDateTime pattern="dd/MM/yyyy"/>
					</h:outputText>
				</h:panelGrid>
				
				<h:panelGrid columns="6" style="padding:5px;">
					<h:outputText style="font-weight:bold;padding:7px;" value="Multa (R$)" />
					<h:outputText style="font-weight:bold;padding:7px;" value="Juros (%)" />
					<h:outputText style="font-weight:bold;padding:7px;" value="Desconto (R$)" />
					<h:outputText style="font-weight:bold;padding:7px;" value="Desconto (%)" />
					<h:outputText style="font-weight:bold;padding:7px;" value="Data de pagamento" />
					<h:outputText style="font-weight:bold;padding:7px;" value="Valor pago" rendered="#{contaReceberBean.currentConta.status == 'PAGA'}"/>
					<h:outputText style="font-weight:bold;padding:7px;" value="Valor total" rendered="#{contaReceberBean.currentConta.status != 'PAGA'}"/>
						
					<h:outputText style="padding:7px;" value="#{contaReceberBean.currentConta.multa}">
						<f:convertNumber pattern="R$ #,###,##0.00" />
					</h:outputText>
					<h:outputText style="padding:7px;" value="#{contaReceberBean.currentConta.juros}">
						<f:convertNumber pattern="#,###,##0.00" />
					</h:outputText>
					<h:outputText style="padding:7px;" value="#{contaReceberBean.currentConta.descontoValor}">
						<f:convertNumber pattern="R$ #,###,##0.00" />
					</h:outputText>
					<h:outputText style="padding:7px;" value="#{contaReceberBean.currentConta.descontoPercentual}">
						<f:convertNumber pattern="#,###,##0.00" />
					</h:outputText>
					<h:outputText style="padding:7px;" value="#{contaReceberBean.currentConta.dataPagamento}">
						<f:convertDateTime pattern="dd/MM/yyyy"/>
					</h:outputText>					
					<h:outputText style="padding:7px;"  value="#{contaReceberBean.currentConta.valorPago}">
						<f:convertNumber pattern="R$ #,###,##0.00" />
					</h:outputText>				
				</h:panelGrid>
				
				<h:panelGrid columns="1" style="padding:5px;" rendered="#{contaReceberBean.currentConta.condicaoPagamento != null}">
					<h:outputText style="font-weight:bold;padding:7px;"  value="Condição de pagamento" />
					<h:outputText style="padding:7px;" value="#{contaReceberBean.currentConta.condicaoPagamento.condicaoPagamento}"/>
				</h:panelGrid>
			</div>
		</p:panel>		
	</ui:define>
</ui:composition>